package com.wesley.provider;

import com.wesley.framework.Protocol;
import com.wesley.framework.ProtocolFactory;
import com.wesley.framework.URL;
import com.wesley.framework.register.LocalRegister;
import com.wesley.framework.register.RemoteMapRegister;
import com.wesley.provider.api.HelloService;
import com.wesley.provider.impl.HelloServiceImpl;

/**
 * Provider
 *
 * @author WangPanYong
 * @since 2021/11/17 11:24
 */
public class Provider {

    public static void main(String[] args) {
        // 1. 注册服务
        // 2. 本地注册
        // 3. 启动 Server

        URL url = new URL("127.0.0.1", 9002); //NetUtil
        RemoteMapRegister.register(HelloService.class.getName(), url);

        //  服务：实现类
        LocalRegister.regist(HelloService.class.getName(), HelloServiceImpl.class);

        Protocol protocol = ProtocolFactory.getProtocol();
        protocol.start(url);
    }

}
